package org.huamoxi.controller;

import org.huamoxi.entity.ArticleEntity;
import org.huamoxi.feign.ArticleFeign;
import org.huamoxi.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/article")
public class ArticleController {

    @Resource
    ArticleService articleService;

    @Autowired
    ArticleFeign articleFeign;

    @GetMapping("/list")
    public List<ArticleEntity> list() {
        return articleService.list();
    }

    @GetMapping("/{artId}")
    public ArticleEntity list(@PathVariable("artId") Long id) {
        return articleService.getById(id);
    }
}
